
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Rectangle)
{
	TEST(should be able to calc perimeter: length=10, width=5, perimeter=30)
	{
		Rectangle rectangle(10, 5);
		ASSERT_EQ(30, rectangle.getPerimeter());
	}

	TEST(should be able to calc area: length=10, width=5, area=50)
	{
		Rectangle rectangle(10, 5);
		ASSERT_EQ(50, rectangle.getArea());
	}

	TEST(should be able to set length: length=15, width=5, perimeter=40, area=75)
	{
		Rectangle rectangle(10, 5);
		ASSERT_EQ(15, rectangle.setLength(15));
		ASSERT_EQ(40, rectangle.getPerimeter());
		ASSERT_EQ(75, rectangle.getArea());
	}

	TEST(should be able to set width: length=10, width=10, perimeter=40, area=100)
	{
		Rectangle rectangle(10, 5);
		ASSERT_EQ(10, rectangle.setWidth(10));
		ASSERT_EQ(40, rectangle.getPerimeter());
		ASSERT_EQ(100, rectangle.getArea());
	}

	TEST(should be able to set length & width: length=20, width=15, perimeter=70, area=300)
	{
		Rectangle rectangle(10, 5);
		ASSERT_EQ(20, rectangle.setLength(20));
		ASSERT_EQ(15, rectangle.setWidth(15));
		ASSERT_EQ(70, rectangle.getPerimeter());
		ASSERT_EQ(300, rectangle.getArea());
	}
};
